home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / pyshared / chardet / sbcsgroupprober.py < prev    next >
Text File  |  2006-10-21  |  3KB  |  65 lines

  1. ######################## BEGIN LICENSE BLOCK ########################
  2. # The Original Code is Mozilla Universal charset detector code.
  3. #
  4. # The Initial Developer of the Original Code is
  5. # Netscape Communications Corporation.
  6. # Portions created by the Initial Developer are Copyright (C) 2001
  7. # the Initial Developer. All Rights Reserved.
  8. #
  9. # Contributor(s):
  10. #   Mark Pilgrim - port to Python
  11. #   Shy Shalom - original C code
  12. #
  13. # This library is free software; you can redistribute it and/or
  14. # modify it under the terms of the GNU Lesser General Public
  15. # License as published by the Free Software Foundation; either
  16. # version 2.1 of the License, or (at your option) any later version.
  17. # This library is distributed in the hope that it will be useful,
  18. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  20. # Lesser General Public License for more details.
  21. # You should have received a copy of the GNU Lesser General Public
  22. # License along with this library; if not, write to the Free Software
  23. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  24. # 02110-1301  USA
  25. ######################### END LICENSE BLOCK #########################
  26.  
  27. import constants, sys
  28. from charsetgroupprober import CharSetGroupProber
  29. from sbcharsetprober import SingleByteCharSetProber
  30. from langcyrillicmodel import Win1251CyrillicModel, Koi8rModel, Latin5CyrillicModel, MacCyrillicModel, Ibm866Model, Ibm855Model
  31. from langgreekmodel import Latin7GreekModel, Win1253GreekModel
  32. from langbulgarianmodel import Latin5BulgarianModel, Win1251BulgarianModel
  33. from langhungarianmodel import Latin2HungarianModel, Win1250HungarianModel
  34. from langthaimodel import TIS620ThaiModel
  35. from langhebrewmodel import Win1255HebrewModel
  36. from hebrewprober import HebrewProber
  37.  
  38. class SBCSGroupProber(CharSetGroupProber):
  39.     def __init__(self):
  40.         CharSetGroupProber.__init__(self)
  41.         self._mProbers = [ \
  42.             SingleByteCharSetProber(Win1251CyrillicModel),
  43.             SingleByteCharSetProber(Koi8rModel),
  44.             SingleByteCharSetProber(Latin5CyrillicModel),
  45.             SingleByteCharSetProber(MacCyrillicModel),
  46.             SingleByteCharSetProber(Ibm866Model),
  47.             SingleByteCharSetProber(Ibm855Model),
  48.             SingleByteCharSetProber(Latin7GreekModel),
  49.             SingleByteCharSetProber(Win1253GreekModel),
  50.             SingleByteCharSetProber(Latin5BulgarianModel),
  51.             SingleByteCharSetProber(Win1251BulgarianModel),
  52.             SingleByteCharSetProber(Latin2HungarianModel),
  53.             SingleByteCharSetProber(Win1250HungarianModel),
  54.             SingleByteCharSetProber(TIS620ThaiModel),
  55.             ]
  56.         hebrewProber = HebrewProber()
  57.         logicalHebrewProber = SingleByteCharSetProber(Win1255HebrewModel, constants.False, hebrewProber)
  58.         visualHebrewProber = SingleByteCharSetProber(Win1255HebrewModel, constants.True, hebrewProber)
  59.         hebrewProber.set_model_probers(logicalHebrewProber, visualHebrewProber)
  60.         self._mProbers.extend([hebrewProber, logicalHebrewProber, visualHebrewProber])
  61.  
  62.         self.reset()
  63.